package reflect;
/**
 * JDK5之后Java提供了一个特性:变长参数
 */
public class ArgsDemo {
    public static void main(String[] args) {
        //变长参数只能是方法的最后一个参数!!!
        //变长参数是编译器认可的，最终编译后会被改为数组
        /*
        doSome(1,new String[]{});
        doSome(1,new String[]{"one"});
        doSome(1,new String[]{"one","two"});
        doSome(1,new String[]{"one","two","three"});
        doSome(1,new String[]{"one","two","three","four"});
        doSome(1,new String[]{"one","two","three","four","five"});
         */
        doSome(1);
        doSome(1,"one");
        doSome(1,"one","two");
        doSome(1,"one","two","three");
        doSome(1,"one","two","three","four");
        doSome(1,"one","two","three","four","five");
    }

    //public static void doSome(int a,String[] args){
    public static void doSome(int a,String... args){
        System.out.println(args.length);
    }

}















